package com.zhengqiangblog.blog.task;

import java.util.TimerTask;

import org.apache.log4j.Logger;

import com.zhengqiangblog.blog.service.ArticleService;
import com.zhengqiangblog.core.ApplicationContext;

public class PersistArticleViewsTask extends TimerTask {

	private static final Logger logger = Logger.getLogger(PersistArticleViewsTask.class);

	private ArticleService articleService = ApplicationContext.get(ArticleService.class);

	@Override
	public void run() {
		try {
			articleService.persistArticleViews();
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
		}
	}

}
